<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <style>
        .pink{
            background-color: pink;
        }
    </style>
</head>
<body>
    <!-- js 是在浏览器的语言 -->
    <!-- 表单验证，数据交互，  -->
<button class="'pink'">按钮1</button>
<button>按钮2</button>
<button>按钮2</button>
<button>按钮2</button>

<!-- <script>
    let bts = document.querySelectorAll('button');
    for (let i = 0; i < bts.length; i++){
        bts[i].onclick = function(){
            this.style.backgroundColor = 'pink';
        }
    }
</script> -->

<script>

    let bts = document.querySelectorAll('button');
    let bt = bts[1]
    bt.onclick = function(){
        alert('努力奋斗')
    }
</script>

</body>
</html>